#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main()
{
	// 都开始读文件了，文件肯定存在了。
	int fd = open("log.txt", O_RDONLY);

	char buff[125];

	ssize_t size = 1;

	while(size > 0)
	{
		size = read(fd,buff,sizeof(buff) - 1);
		buff[size] = 0;
		printf("%s\n",buff);
		printf("%ld\n",size);
	}

	close(fd);

	return 0;
}
